package org.marketlive.entity;

/*
(C) Copyright MarketLive. 2006. All rights reserved.
MarketLive is a trademark of MarketLive, Inc.
Warning: This computer program is protected by copyright law and international treaties.
Unauthorized reproduction or distribution of this program, or any portion of it, may result
in severe civil and criminal penalties, and will be prosecuted to the maximum extent
possible under the law.
*/

/**
 * Encapsulates methods that relate to a Hibernate implementation of the API.
 */
public interface IMMLHibernate {

    /**
     * Rebinds a detached <code>IEntity</code> to the current Hibernate session for a given request.
     * Useful for retrieving lazy-loaded collections belonging to the entity.
     *
     * @return an <code>IEntity</code> that is bound to the current Hibernate session
     */
    IEntity refreshEntity();

    /**
     * Rebinds the entity to the current Hibernate session for a given request.
     * Bypasses any cache, going directly to the database to retrieve the entity.
     * Takes a lock that prevents other processes from reading or modifying the entity
     * until the Hibernate session is closed. Use judiciously!
     *
     * @return an <code>IEntity</code> that is bound to the current Hibernate session
     *         and that cannot be accessed by any other process
     */
    IEntity refreshEntityLock();

}
